package com.example.project7.utils;

import android.util.Log;

import com.example.project7.model.LoginRequest;
import com.example.project7.model.LoginResponse;

public class TestHttpUtil {
    private static final String TAG = "TestHttpUtil";
    
    /**
     * 测试登录功能
     */
    public static void testLogin() {
        new Thread(() -> {
            try {
                // 使用reqres.in测试API的示例账户
                LoginRequest request = new LoginRequest("eve.holt@reqres.in", "cityslicka");
                ApiResponse<LoginResponse> response = HttpUtil.post("https://reqres.in/api/login", request, LoginResponse.class);
                
                if (response.isSuccess()) {
                    Log.d(TAG, "登录测试成功，Token: " + response.getData().getToken());
                } else {
                    Log.e(TAG, "登录测试失败: " + response.getErrorMessage());
                }
            } catch (Exception e) {
                Log.e(TAG, "登录测试异常", e);
            }
        }).start();
    }
}